#include<16f877a.h>
#include<string.h>
#include<stdio.h>
//#include<input.c>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)

#BYTE RCREG = 0x1A           //Receive char 

unsigned char str[11],i;
unsigned char card_id[10];
unsigned char data[]="Unique ID No.";
unsigned char a[]={"0012813964"};

unsigned char b[]={"0012813965"};

#INT_RDA 
void SerialDataReceive() 
{
	card_id[i]=RCREG;		// Store the received data byte by byte
	i++;
}

void cmd(char r)
{
      output_e (0x00);
      output_d (r);
      output_e (0x02);
      delay_us (100);
      output_e (0x00);
      delay_ms (100);
}
void init_lcd()
{
   unsigned char x[] ={ 0x38,0x0E,0x01,0x06,0x02};

   unsigned char i;

   for( i = 0 ; i < 5 ; i++ )
   {
   cmd(x[i]);
   }
}

void display(unsigned int s)
{
   output_e (0x01);
   output_d (s);
   output_e (0x03);
   delay_ms (20);
   output_e (0x01);
   delay_ms (100);
}

void main()
{

 init_lcd ();
 printf("rfid");
enable_interrupts(INT_RDA); 
enable_interrupts(GLOBAL); 

   while(data[i]!='\0')
	{
		display(data[i]);	// To send characters one by one from 'data' array
		i++;
      //delay_ms(1000);
	}
   while(1)
	{
		i=0;
		while(i<12);
		cmd(0xC0);
		i=0;
		while(i<11)
		{
			display(card_id[i]);	// Print the 12 byte received data
			i++;
       //  delay_ms(1000);
		}
     // cmd(0x01);
	}
   
 
}   




